using System;
using System.Collections.Generic;
using System.Text;
using Buka.BLL.Model; 
namespace Buka.BLL.Provider
{
    [System.ComponentModel.DataObject()]
    public class MasterCategoryProvider
    {
        #region "Fill & Get"

        public void FillObjectsFromDataRow(Buka.DAL.Masters.Master_CategoriesRow row, MasterCategory obj)
        {
            obj.Id = row.id;
            obj.Caption = row.caption;
            if (row.IsdescriptionNull())
            {
                obj.Description = "";
            }
            else
            {
                obj.Description = row.description;
            }
            if (row.Isparent_idNull())
            {
                obj.ParentId = 0;
            }
            else
            {
                obj.ParentId = row.parent_id;
            }
        }

        public MasterCategory GetObjectFromDataRow(Buka.DAL.Masters.Master_CategoriesRow row)
        {
            MasterCategory masterCategory = new MasterCategory();
            try
            {
                masterCategory = GetObjectFromDataRow(row);
            }
            catch (Exception ex)
            {
                
                throw new ArgumentException(ex.Message);
            }
            return masterCategory;
        }

        #endregion
    }
}
